import Vue from 'vue'
import App from './App'
import router from './router'

import ElementUI from 'element-ui'
import {Form,FormItem,Input,Button,Message,Container,Header,Aside,Main,Menu,Submenu,MenuItem,MenuItemGroup,Select} from 'element-ui'

//导入加载进度条 nprogress 和 css
import NProgress from 'nprogress';
import 'nprogress/nprogress.css'
import axios from 'axios'
//在request 拦截器 展示进度条 NProgress.start();
axios.interceptors.request.use(config=>{
  config.headers.Authorization = window.sessionStorage.getItem('token');
  NProgress.start();
  return config;
})
//在response 拦截器 隐藏进度条   NProgress.done();
axios.interceptors.response.use(config=>{
  NProgress.done();
  return config;
})

axios.defaults.baseURL = 'http://127.0.0.1:8082';//访问外部 接口的根路径

Vue.prototype.$http =axios;

Vue.prototype.$message =Message;

Vue.config.productionTip = false


Vue.use(ElementUI);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Button);

Vue.use(Container);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main);

Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Select);


//导入全局样式表
import 'element-ui/lib/theme-chalk/index.css';
import './components/css/global.css'

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
